package com.woniu.platform.contorller;

import com.woniu.platform.entity.PlatformOrderForm;
import com.woniu.platform.service.PlatformOrderFormService;

import com.woniu.util.utils.HttpResult;
import com.woniu.util.utils.RequestResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/orderForm")
public class PlatformOrderFormController {
    @Autowired(required = false)
    private PlatformOrderFormService orderFormService;

    /**
     * 生成订单
     * @param platformOrderForm
     * @return
     */
    @PostMapping("/insertOrder")
    public HttpResult insertOrderFormAc(@RequestBody PlatformOrderForm platformOrderForm){
        return orderFormService.insertOrderFormAc(platformOrderForm);
    }

    /**
     * 处理订单
     * @param platformOrderForm
     * @return
     */
    @RequestMapping("/updateOrder")
    public HttpResult updateOrderForm(@RequestBody PlatformOrderForm platformOrderForm){
        return orderFormService.updateOrderForm(platformOrderForm);
    }

    /**
     * 查询订单
     */
    @PostMapping("/queryOrder")
    public HttpResult queryOrderForm(@RequestBody RequestResult<PlatformOrderForm> requestResult){
        return orderFormService.queryOrderForm(requestResult);
    }

    /**
     * 根据用户id查询订单
     */
    @GetMapping("/queryOrderByCustomerId")
    public HttpResult queryOrderFormByCustomerId(String customerId){
        return orderFormService.queryOrderFormByCustomerId(customerId);
    }
}
